﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site3forAdmin.Master" AutoEventWireup="true" CodeBehind="FAQforAdmin.aspx.cs" Inherits="WebApp.FAQforAdmin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

<script language="javascript" type="text/javascript">
    function validateForm() {
        if (document.getElementById("<%=txtQues.ClientID%>").value == "") {
            alert("Question cannot be blank ^^~♥ !");
            document.getElementById("<%=txtQues.ClientID%>").focus();
            return false;
        }
        if (document.getElementById("<%=txtAns.ClientID%>").value == "") {
            alert("Annser cannot be blank ^^~♥  !");
            document.getElementById("<%=txtAns.ClientID%>").focus();
            return false;
        }
        return true;
    }
    </script>



    <table style="width:100%;">
        <tr>
            <td>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    EnableModelValidation="True" 
                    onrowcancelingedit="GridView1_RowCancelingEdit" 
                    onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" 
                    onrowupdating="GridView1_RowUpdating">
                    <Columns>
                        <asp:BoundField DataField="faqID" HeaderText="FAQ ID" />
                        <asp:BoundField DataField="ques" HeaderText="Question" />
                        <asp:BoundField DataField="ans" HeaderText="Answer" />
                        <asp:CommandField ShowEditButton="True" />
                        <asp:CommandField ShowDeleteButton="True" />
                    </Columns>
                </asp:GridView>
                <br />
                <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/Home.aspx">Come back to Home</asp:LinkButton>
            </td>
        </tr>
        <tr>
            <td>
    <table style="width:100%;">
        <tr>
            <td style="width: 304px">
                Question</td>
            <td>
                <asp:TextBox ID="txtQues" runat="server" Width="500px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 304px">
                Answer</td>
            <td>
                <asp:TextBox ID="txtAns" runat="server" Width="500px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 304px">
                Note: All fields cannot be blank</td>
            <td>
            </td>
        </tr>
        <tr>
            <td style="width: 304px">
                <asp:Button ID="btninsert" runat="server" Text="Insert" 
                    onclick="btninsert_Click" OnClientClick=" return validateForm();" />
                <asp:Button ID="btnclear" runat="server" Text="Clear All" 
                    onclick="btnclear_Click" />
            </td>
            <td>
            </td>
        </tr>
    </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
